package com.cuitrip.business.pay.adapter;

import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.cuitrip.business.notice.model.FeeDescription;
import com.cuitrip.business.pay.model.PayMode;
import com.cuitrip.service.R;

import java.util.ArrayList;

/**
 * Created by sheena on 16/3/14.
 */
public class FeeDescriptionAdapter extends RecyclerView.Adapter<FeeDescriptionAdapter.ViewHolde> {
    private ArrayList<FeeDescription> list;

    public void setDescription(ArrayList<FeeDescription> list){
        this.list=list;
    }

    @Override
    public ViewHolde onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.adapter_rv_fee_description, parent, false);
        ViewHolde viewHolder = new ViewHolde(view);
        return viewHolder;
    }

    @Override
    public void onBindViewHolder(ViewHolde holder, int position) {
        FeeDescription description = list.get(position);
        holder.tvFeeTitle.setText(description.getTitle());
        holder.tvFeeContent.setText(description.getContent());
    }

    @Override
    public int getItemCount() {
        if (list!=null) {
            return list.size();
        }else{
            return 0;
        }
    }

    public static class ViewHolde extends RecyclerView.ViewHolder{

        private final TextView tvFeeTitle;
        private final View separation;
        private final TextView tvFeeContent;

        public ViewHolde(View itemView) {
            super(itemView);
            tvFeeTitle = (TextView) itemView.findViewById(R.id.tv_fee_title);
            separation = itemView.findViewById(R.id.view);
            tvFeeContent = (TextView) itemView.findViewById(R.id.tv_fee_content);
        }
    }
}
